package com.zhubayi.daka.excption;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;


/**
 * 全局异常处理
 * @author 祝八一
 */
@ControllerAdvice
public class GlobalException {
    @ExceptionHandler(Exception.class)
    public String sqlException(Exception e, RedirectAttributes model){
       model.addFlashAttribute("msg","打卡失败");
        e.printStackTrace();
        return "redirect:/index";

    }
}
